<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Ramda</title>
</head>
<body>
    <script src="../ramda.min.js"></script>
    <script>
        var students = [
            { name: 'Abby', score: 84 },
            { name: 'Eddy', score: 58 },
            { name: 'Tom', score: 92 },
            { name: 'Jack', score: 69 }
        ];

        var res = R.groupBy(item => {
            var n = item.score;
            return n < 60 ? 'F':
                n < 70 ? 'D':
                n < 80 ? 'C':
                n < 90 ? 'B': 'A';
        }, students);

        console.log(res);
    </script>
</body>
</html>